/*
 * @Author: your name
 * @Date: 2021-12-23 13:41:24
 * @LastEditTime: 2021-12-23 19:42:50
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day12 ts 路由 月考\my-app\src\views\index\index.tsx
 */
import React, { Component } from 'react'
import {RouterItem} from "../../router/Router.d"

import RouterView from '../../router/RouterView'
import {NavLink} from "react-router-dom"

import IndexModule from "./index.module.scss"

interface IProps{
    RouterList:RouterItem[],
    navLink:RouterItem[]
}

// interface PropsLink{
//     path:string,
//     component:any,
//     title:string
// }

export default class index extends Component<IProps,{}> {
    render() {
        let {RouterList,navLink}=this.props
        return (
            <div className={IndexModule.index}>
                <div className={IndexModule.main}>
                    <RouterView RouterList={RouterList}/>
                </div>
                <div className={IndexModule.footer}>
                    {
                        navLink&&navLink.length?navLink.map((item,index)=>{
                            return <NavLink to={item.path} key={index}>{item.title}</NavLink>
                        }):<div>暂无数据</div>
                    }
                </div>
            </div>
        )
    }
}
